package com.chuyu.jzwboa.activity.offciemobile;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.chuyu.jzwboa.R;
import com.chuyu.jzwboa.adapter.message.MsgViewPagerAadapter;
import com.chuyu.jzwboa.base.MVPBaseActivity;
import com.chuyu.jzwboa.fragment.offmoblie.ReceiveDocFragment;
import com.chuyu.jzwboa.fragment.offmoblie.SendDocFragment;
import com.chuyu.jzwboa.fragment.offmoblie.SignDocFragment;
import com.chuyu.jzwboa.presenter.offmobile.OffDocPresenter;
import com.chuyu.jzwboa.utils.sys.StatusBarUtils;
import com.chuyu.jzwboa.utils.sys.TabLayoutUtil;
import com.chuyu.jzwboa.view.iview.offmobile.IOffDocView;
import com.facebook.drawee.view.SimpleDraweeView;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * @author 杨仕俊
 * @description 公文管理
 */
public class OffDocManageActivity extends MVPBaseActivity<IOffDocView, OffDocPresenter> implements IOffDocView {


    @BindView(R.id.titel_left_img)
    SimpleDraweeView titelLeftImg;
    @BindView(R.id.title_text)
    TextView titleText;
    @BindView(R.id.title_right_img)
    SimpleDraweeView titleRightImg;
    @BindView(R.id.titel_rl)
    RelativeLayout titelRl;
    @BindView(R.id.tab_layout)
    TabLayout tabLayout;
    @BindView(R.id.off_doc_viewpager)
    ViewPager offDocViewpager;

    @Override
    protected int initContent() {
        return R.layout.activity_off_doc;
    }

    @Override
    protected void initView() {
        titleText.setText("公文管理");
        /**
         * 动态设置状态栏高度
         */
        int statusHeight = StatusBarUtils.getStatusHeight(this);
        titelRl.setPadding(0, statusHeight, 0, 0);

        SendDocFragment sendDocFragment = new SendDocFragment();
        ReceiveDocFragment receiveDocFragment = new ReceiveDocFragment();
        SignDocFragment signDocFragment = new SignDocFragment();
        List<String> list = new ArrayList<>();
        List<Fragment> listfragment = new ArrayList<>();
        list.add("发文");
        list.add("收文");
        list.add("签报");
        listfragment.add(sendDocFragment);
        listfragment.add(receiveDocFragment);
        listfragment.add(signDocFragment);
        MsgViewPagerAadapter pagerAadapter = new MsgViewPagerAadapter(getSupportFragmentManager(), list, listfragment);
        offDocViewpager.setAdapter(pagerAadapter);
        tabLayout.setTabGravity(TabLayout.GRAVITY_CENTER);
        TabLayoutUtil.reflexToWith(tabLayout);
        tabLayout.setupWithViewPager(offDocViewpager);



        titelLeftImg.setImageResource(R.mipmap.icon_add_1);
        titleRightImg.setImageResource(R.mipmap.ic_launcher_round);
    }

    @Override
    protected void initData() {

    }

    @NonNull
    @Override
    public OffDocPresenter createPresenter() {
        return new OffDocPresenter();
    }




    @OnClick({R.id.titel_left_img, R.id.title_right_img})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.titel_left_img:
                finish();
                break;
            case R.id.title_right_img:

                break;
            default:
                break;
        }
    }
}
